<!-- 企业详情 -->
<template>
	<view class="company-detail hideToShow">
		<panel title="企业信息">
			<view class="content">
				<view class="list" v-if="Object.keys(info).length && isShow">
					<view class="cell coustom-border-bottom">
						<text class="label">企业名称</text>
						<text class="value">{{ info.c_name }}</text>
					</view>
					<view class="cell">
						<text class="label">统一社会信用代码</text>
						<text class="value">{{ info.code }}</text>
					</view>
					<view class="cell">
						<text class="label">注册地址</text>
						<text class="value">{{ info.reg_address }}</text>
					</view>
					<view class="cell">
						<text class="label">注册资金</text>
						<text class="value">{{ info.money }}</text>
					</view>
					<view class="cell">
						<text class="label">法人/负责人</text>
						<text class="value">{{ info.manager }}</text>
					</view>
					<view class="cell">
						<text class="label">负责人联系电话</text>
						<text class="value">{{ info.phoneNum }}</text>
					</view>
					<view class="cell">
						<text class="label">企业邮箱</text>
						<text class="value">{{ info.email }}</text>
					</view>
					<view class="cell">
						<text class="label">经营范围</text>
						<text class="value">{{ info.scope }}</text>
					</view>
					<view class="cell">
						<text class="label">企业联系地址</text>
						<text class="value">{{ info.real_address }}</text>
					</view>
				</view>
				<PageNo desc="暂无企业信息" height="30vh" v-if="!isShow && !Object.keys(info).length" />
			</view>
		</panel>
	</view>
</template>

<script>
export default {
	data() {
		return {
			id: '',
			info: {},
			isShow: true
		};
	},
	onLoad(options) {
		this.id = options.id;
		this.getSelfDetail();
	},
	methods: {
		// 获取企业详情
		async getSelfDetail() {
			const res = await uniCloud.callFunction({
				name: 'detail',
				data: {
					id: this.id,
					type: 'company'
				},
				success: res => {
					let data = res.result;
					if (data.success) {
						this.isShow = true;
						this.info = data.data;
						return;
					}
					this.isShow = false;
					this.$until.showToast(res.message);
				}
			});
		}
	}
};
</script>

<style lang="scss" scoped>
.company-detail {
	width: 100%;

	.content {
		width: 100%;
		padding: 0 32rpx;

		.list {
			width: 100%;

			.cell {
				display: flex;
				font-size: 24rpx;
				padding: 32rpx 0;
				position: relative;
				align-items: center;
				justify-content: space-between;

				.label {
					flex: 1;
					color: #101010;
					font-size: 28rpx;
					display: inline-block;
				}

				.value {
					color: #999999;
					max-width: 60%;
					text-align: right;
					white-space: pre-line;
				}

				&::after {
					left: 0;
					bottom: 0;
					content: '';
					width: 200%;
					height: 2rpx;
					position: absolute;
					transform: scale(0.5);
					background-color: #ccc;
					transform-origin: left top;
					-webkit-transform: scale(0.5);
				}
			}
		}
	}
}
</style>
